USE [TP_AI_Telefonia]
GO

/****** Object:  Table [dbo].[ItemFacturas]    Script Date: 11/7/2012 9:45:02 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ItemFacturas](
	[ItemFacturaId] [int] IDENTITY(1,1) NOT NULL,
	[FacturaId] [int] NOT NULL,
	[ConsumoId] [int] NOT NULL,
	[Costo] [float] NOT NULL,
 CONSTRAINT [PK_ItemFacturas] PRIMARY KEY CLUSTERED 
(
	[ItemFacturaId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ItemFacturas]  WITH CHECK ADD  CONSTRAINT [FK_ItemFacturas_Consumos] FOREIGN KEY([ConsumoId])
REFERENCES [dbo].[Consumos] ([ConsumoId])
GO

ALTER TABLE [dbo].[ItemFacturas] CHECK CONSTRAINT [FK_ItemFacturas_Consumos]
GO

ALTER TABLE [dbo].[ItemFacturas]  WITH CHECK ADD  CONSTRAINT [FK_ItemFacturas_Facturas] FOREIGN KEY([FacturaId])
REFERENCES [dbo].[Facturas] ([FacturaId])
GO

ALTER TABLE [dbo].[ItemFacturas] CHECK CONSTRAINT [FK_ItemFacturas_Facturas]
GO

